package com.lakers.notice.springboot.runner;

import com.lakers.notice.springboot.netty.NoticeServer;
import lombok.AllArgsConstructor;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.PreDestroy;


/**
 * 功能描述: NoticeNettyServerRunner
 *
 * @author liqin(zxl)
 * @date 2024/5/5
 */
@Component
@AllArgsConstructor
public class NoticeNettyServerRunner implements ApplicationRunner {

    private final NoticeServer noticeServer;

    @Override
    public void run(ApplicationArguments args) {
        noticeServer.start();
    }

    @PreDestroy
    public void destroy() {
        noticeServer.stop();
    }
}
